package com.bear.fastrepair.base

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.viewbinding.ViewBinding
import com.bear.fastrepair.utils.ViewBindingHelper.inflateBindingWithGeneric

abstract class BaseActivity<VB : ViewBinding> : AppCompatActivity() {
    private var _binding: VB? = null
    protected val binding by lazy {
        _binding ?: throw NullPointerException("view binding must not be null")
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        _binding = inflateBindingWithGeneric(layoutInflater)
        setContentView(_binding?.root)
    }
}